package edu.udo.sopra10.chaturaji.entities;

import static edu.udo.sopra10.chaturaji.util.ExceptionUtil.assertInRange;
import edu.udo.sopra10.chaturaji.entities.pieces.Piece;

/**
 * A move is the (potential) movement of a single {@link Piece}. If a piece was
 * actually moved, a {@link PieceMove} is made, else, a {@link Pass}.
 * 
 * @author Simon Dierl
 */
public class Move {
	/**
	 * Create a new pass with the given parameters.
	 * 
	 * @param diceRoll
	 *            the result of the dice roll that was used in this move, must
	 *            be in {@code [1, 6]}.
	 */
	protected Move(Byte diceRoll) {
		setDiceRoll(diceRoll);
	}

	/**
	 * The dice roll assigned to this move.
	 */
	protected byte diceRoll;

	/**
	 * Get the dice roll used for this move.
	 * 
	 * @return the dice roll used, always in {@code [1, 6]}.
	 */
	public byte getDiceRoll() {
		return diceRoll;
	}

	/**
	 * Set the dice roll used for this move.
	 * 
	 * @param diceRoll
	 *            the new dice roll used, must be in {@code [1, 6]}.
	 */
	public void setDiceRoll(final byte diceRoll) {
		this.diceRoll = assertInRange(diceRoll, (byte) 1, (byte) 6, "dice roll");
	}
}
